//
//  UIBarButtonItem+XWExtension.m
//  CGWSWW
//
//  Created by lanou3g on 16/8/12.
//  Copyright © 2016年 CXG. All rights reserved.
//

#import "UIBarButtonItem+XWExtension.h"

@implementation UIBarButtonItem (XWExtension)
+(UIBarButtonItem*)initWithImage:(NSString*)image highImage:(NSString*)hightImage target:(id)target action:(SEL)action forControlEvent:(UIControlEvents)controlEvent{
    UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [button setImage:[UIImage imageNamed:image] forState:(UIControlStateNormal)];
    [button setImage:[UIImage imageNamed:hightImage] forState:(UIControlStateHighlighted)];
    [button addTarget:target action:action forControlEvents:controlEvent];
    return [[UIBarButtonItem alloc]initWithCustomView:button];
}
@end
